package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ConvertDoubleArrayToFloatArray {
	public static void main(String[] argv) {
		double[] doubleArray = new double[]{34.45, 35.45, 36.67, 37.78, 37.0000, 37.1234, 67.2344, 68.34534, 69.87700};
		System.out.println(java.util.Arrays.toString(toFloatArray(doubleArray)));
	}

	static float[] toFloatArray(final double[] doubleArray) {
		if (doubleArray == null) {
			return null;
		} else {
			final int size = doubleArray.length;
			final float[] floatArray = new float[size];
			for (int i = 0; i < size; i++) {
				floatArray[i] = (float) doubleArray[i];
			}
			return floatArray;
		}
	}
}
